from django.contrib import admin
from psd.register.models import Person, RegRecord
from psd.register.forms import PersonForm, RegRecordForm

## For some reason, using 'gender' in list_display shows the full name ('male', 'female')
## if a person has one gender, and 'None' if they have several. This works better.
def gender(p):
    return p.gender

class MyPerson(admin.ModelAdmin):
    form = PersonForm
    list_display = (unicode, 'psdid', 'age', gender)
    list_filter = ('gender',)

class MyReg(admin.ModelAdmin):
    form = RegRecordForm
    list_filter = ('paid','cancelled')
admin.site.register(Person, MyPerson)
admin.site.register(RegRecord, MyReg)
